class Solution {
public:
    vector<int> countBits(int n)
    {
        vector<int> ret;
        for (int i = 0; i <= n; i += 2)
        {
            int tmp = 0;
            for (int j = 0; j < 32; j++)
            {
                tmp += (i >> j) & 1;
            }
            ret.push_back(tmp);
            ret.push_back(tmp + 1);
        }
        if (n % 2 == 0)
            ret.pop_back();
        return ret;
    }
};
